<template>
    <el-image
            style="width: 200px; height: 300px"
            :src="url"
            fit="cover"
    ></el-image>
    <div>
        <h3>账户:{{$store.state.admin.admin.account}}</h3>
        <h3>姓名:{{$store.state.admin.admin.name}}</h3>
        <h3>电话:{{$store.state.admin.admin.phone}}</h3>
        <h3>角色:{{$store.state.admin.admin.role}}</h3>
    </div>

</template>

<script>
    import api from "../../api";
    import {onMounted} from  'vue'
    import {useStore} from 'vuex'
    export default {
        name: "Mine",
        setup(){
            let $store = useStore()
            onMounted(async ()=>{
            const {data:res} =await api.getAccountList()
                // console.log(res.data)
                $store.dispatch('admin/setAdmin',res.data[0])
            })
            // 将管理员名称存入本地存储
            localStorage.setItem('rootName',$store.state.admin.admin.name)
            // 图片地址
            const url =
                'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fn1.itc.cn%2Fimg8%2Fwb%2Frecom%2F2017%2F01%2F26%2F148541505179307537.JPEG&refer=http%3A%2F%2Fn1.itc.cn&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1649318474&t=1cbc1fba452c5539430ca94cbd451b95'
            return{
                url
            }
        }

    }
</script>

<style scoped>

</style>
